function get_rating_option(b) {
    for (var a = 0; a < rating_option_list.length; a++) if (rating_option_list[a].id == b) return rating_option_list[a];
}

function rate_post(g, d, e, f) {
    post_id = g, d == 1 || d == 2 ? post_rating = 1 : post_rating = d, ratings_count = e;
    if (rating_post_ids.indexOf("," + post_id + ",") < 0) {
        rating_post_ids = rating_post_ids + post_id + ",", post_rating_value = f;
        var c = getCookie("rated_" + post_id);
        if (c != "" && c != null) return clearTimeout(timeout_obj), $("#collect_ul").html(""), $('<li class="collectSuccess">您已经评过分</li>').appendTo("#collect_ul"), $("#collect_div").attr("class", "collect_div_cancel_rating"), setTimeout("show()", 100), timeout_obj = setTimeout("$('#collect_div').fadeOut(1000)", 3e3), !1;
        jQuery("#post-ratings-" + post_id).find(".worth_" + post_rating + " a").html(ratings_count + 1);
        var a = parseInt(jQuery("#post-ratings-" + post_id).find(".rating_users").val()) + 1, b = parseInt(jQuery("#post-ratings-" + post_id).find(".ratings_worth").val());
        return f > 0 ? (b += 1, $("#post-ratings-" + post_id).find(".rating_text").html(a + " 位网友中的<span class='red'> " + b + " </span>位认为值得买！")) : $("#post-ratings-" + post_id).find(".rating_text").html(a + " 位网友中的<span class='red'> " + b + " </span>位认为值得买！"), $("#post-ratings-" + post_id).find("a").removeAttr("href").addClass("noLine"), jQuery.ajax({
            "type": "GET",
            "url": ratingsL10n.ajax_url,
            "data": "pid=" + post_id + "&rate=" + post_rating + "&rating_value=" + f,
            "cache": !1
        }), !1;
    }
    return clearTimeout(timeout_obj), $("#collect_ul").html(""), $('<li class="collectSuccess">您已经评过分</li>').appendTo("#collect_ul"), $("#collect_div").attr("class", "collect_div_cancel_rating"), setTimeout("show()", 100), timeout_obj = setTimeout("$('#collect_div').fadeOut(1000)", 3e3), !1;
}

function getCookie(b) {
    var a = document.cookie.match(new RegExp("(^| )" + b + "=([^;]*)(;|$)"));
    return a != null ? unescape(a[2]) : "";
}

var post_id = 0, post_rating = 0, post_rating_value = 0, is_being_rated = !1, rating_post_ids = ",", ratings_count = 0, ratings_text = "";

ratingsL10n.custom = parseInt(ratingsL10n.custom), ratingsL10n.max = parseInt(ratingsL10n.max), ratingsL10n.show_loading = parseInt(ratingsL10n.show_loading), ratingsL10n.show_fading = parseInt(ratingsL10n.show_fading);

var rating_option_list = ratingsL10n.rating_option_list;